home *** CD-ROM | disk | FTP | other *** search
/ Champak 120 / Vol 120.iso / games / battlefi.swf / scripts / frame_636 / PlaceObject2_331_1319 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2010-11-09  |  1KB  |  69 lines

  1. onClipEvent(enterFrame){
  2.    if(_root.vic)
  3.    {
  4.       this._y = 491.2;
  5.    }
  6.    if(_root.loss)
  7.    {
  8.       this._y = 491.2;
  9.    }
  10.    if(!this.hitTest(_root.castle))
  11.    {
  12.       this._x += speed;
  13.    }
  14.    if(duped && _root.population < _root.poptot)
  15.    {
  16.       _root.population = _root.population + 1;
  17.       _root.gold -= 100;
  18.       i++;
  19.       duplicateMovieClip(_root.inf,"MC" + i,16384 + (200 + i));
  20.       _root["MC" + i]._x = -6.399999999999999;
  21.       _root["MC" + i]._y = random(50) + 201.7;
  22.       duped = false;
  23.    }
  24.    if(this.hitTest(_root.castle) && !attackin)
  25.    {
  26.       this.gotoAndPlay("attk");
  27.       attackin = true;
  28.    }
  29.    if(this.dead && this._currentframe < 18)
  30.    {
  31.       this.gotoAndPlay("die");
  32.    }
  33.    f = 1;
  34.    while(f < Math.round(_root.lvl / 2 + 1))
  35.    {
  36.       if(this.hit.hitTest(_root.castle["th" + f]))
  37.       {
  38.          this.gotoAndPlay("die");
  39.          _root.castle["th" + f].removeMovieClip();
  40.       }
  41.       f++;
  42.    }
  43.    if(this.dead)
  44.    {
  45.       this._x -= speed;
  46.    }
  47.    if(this.deadfull)
  48.    {
  49.       this._x = -1000000000;
  50.       this.gotoAndStop(35);
  51.    }
  52.    l = 1;
  53.    while(l < _root.lvl + 1)
  54.    {
  55.       if(this.hit.hitTest(_root["a" + l]))
  56.       {
  57.          this.gotoAndPlay("die");
  58.          _root["a" + l].removeMovieClip();
  59.       }
  60.       if(remaining == 0)
  61.       {
  62.          this.gotoAndPlay("die");
  63.          remaining = 500;
  64.       }
  65.       this.hp._xscale = remaining / 1 * 100;
  66.       l++;
  67.    }
  68. }
  69.